package com.edu.exam.enums.examination;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 申请状态枚举
 * 管理特殊考试申请的审核状态
 *
 * @author System
 * @version 1.0.0
 */
public enum ApplicationStatus implements BaseEnum {

    DRAFT("DRAFT", "草稿", 1),
    SUBMITTED("SUBMITTED", "已提交", 2),
    UNDER_REVIEW("UNDER_REVIEW", "审核中", 3),
    REVIEW_PASSED("REVIEW_PASSED", "审核通过", 4),
    FINAL_APPROVED("FINAL_APPROVED", "最终批准", 5),
    REJECTED("REJECTED", "已拒绝", 6),
    ARRANGED("ARRANGED", "已安排", 7),
    COMPLETED("COMPLETED", "已完成", 8),
    CANCELLED("CANCELLED", "已撤销", 9);

    private final String code;
    private final String description;
    private final int order;

    ApplicationStatus(String code, String description, int order) {
        this.code = code;
        this.description = description;
        this.order = order;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public int getOrder() {
        return order;
    }

    @Override
    public String toString() {
        return this.code + "(" + this.description + ")";
    }

    public static ApplicationStatus fromCode(String code) {
        for (ApplicationStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown application status code: " + code);
    }
}